#include<iostream>
#include<vector>
#include<queue>
#include<cstring>
#include<cmath>
#include<map>
#include<set>
#include<cstdio>
#include<algorithm>
#define debug(a) cout<<#a<<"="<<a<<endl;
using namespace std;
const int maxn=2e3+10;
typedef long long LL;
inline LL read(){LL x=0,f=1;char ch=getchar();	while (!isdigit(ch)){if (ch=='-') f=-1;ch=getchar();}while (isdigit(ch)){x=x*10+ch-48;ch=getchar();}
return x*f;}
map<LL,vector<LL>>mapy;
map<LL,LL>mapx;
int main(void){
    int n;n=read();
    for(int i=1;i<=n;++i)
    {
        int x,y;x=read();y=read();
        mapy[y].push_back(x);
        mapx[x]++;
    }
    LL ans=0;
    for(auto &i:mapy)
    {
        vector<LL>cnt=i.second;
        for(int j=0;j<cnt.size();j++)
        {
            for(int k=j+1;k<cnt.size();k++)
            {
                int num1=mapx[cnt[j]];
                int num2=mapx[cnt[k]];
                num1--;num2--;
                if(num1>0&&num2>0)
                {
//                    cout<<"i.first="<<i.first<<endl;
//                    cout<<cnt[j]<<" "<<cnt[k]<<endl;
//                    cout<<"num1="<<num1<<" "<<"num2="<<num2<<endl;
                    ans+=min(num1,num2);
                }
            }
        }
        for(auto &j:cnt)
        {
            mapx[j]--;
        }
    }
    printf("%lld\n",ans);
   	return 0;
}
